package sort;

import java.util.Arrays;

/**希尔排序*/
public class shellSort {
    public static void main(String[] args) {
        int [] arr = {5,8,3,4,1,9,6,7,2,0};
        for(int i = arr.length/2;i>0;i/=2){
            for(int j = i;j<arr.length;j++){
                for(int h = j-i;h>=0;h -=i){
                    if(arr[h]>arr[h+i]){
                        int temp = arr[h];
                        arr[h] = arr[h+i];
                        arr[h+i] = temp;
                    }else {
                        break;
                    }
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
